<% layout('/layouts/default.html', {title: 'TT付款单管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('TT付款单管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
<!--				<% if(hasPermi('financial:ttpaymentorder:ttPaymentOrder:edit')){ %>-->
<!--					<a href="${ctx}/financial/ttpaymentorder/ttPaymentOrder/form" class="btn btn-default btnTool" title="${text('新增TT付款单')}"><i class="fa fa-plus"></i> ${text('新增')}</a>-->
<!--				<% } %>-->
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${ttPaymentOrder}" action="${ctx}/financial/ttpaymentorder/ttPaymentOrder/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('编号')}：</label>
					<div class="control-inline">
						<#form:input path="paymentOrderCode" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('服务订单')}：</label>
					<div class="control-inline width-120">
						<#form:select path="serviceOrderId" items="${listServiceOrder}"
						itemLabel="serviceOrderCode" itemValue="serviceOrderId" blankOption="true" class="form-control "/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户')}：</label>
					<div class="control-inline width-120">
						<#form:treeselect id="customer" title="${text('客户选择')}"
						path="customer.customerId" labelPath="customer.customerName"
						url="${ctx}/base/customer/customer/treeData" canSelectRoot="true" canSelectParent="true"
						class=" " allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('资方')}：</label>
					<div class="control-inline width-120">
						<#form:select path="investorId" items="${gnzfList}" itemLabel="supplierName" itemValue="supplierId"
						class="form-control " blankOption="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('外商')}：</label>
					<div class="control-inline width-120">
						<#form:select path="foreignBusinessmenId" items="${hwzfList}" itemLabel="supplierName" itemValue="supplierId"
						class="form-control " blankOption="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('付汇日期')}：</label>
					<div class="control-inline">
						<#form:input path="paymentDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="paymentDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="paymentDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
							dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('车辆')}：</label>
					<div class="control-inline width-120">
						<#form:select path="ttPaymentOrderDetail.carId" items="${tcarList}"
						itemLabel="carName" itemValue="carId" blankOption="true" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('型号')}：</label>
					<div class="control-inline">
						<#form:input path="ttPaymentOrderDetail.model" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('车架号')}：</label>
					<div class="control-inline">
						<#form:input path="ttPaymentOrderDetail.frameNumber" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建者')}：</label>
					<div class="control-inline width-120">
						<#form:select path="createBy" items="${listUser}"
						itemLabel="userName" itemValue="userCode" blankOption="true" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建时间')}：</label>
					<div class="control-inline">
						<#form:input path="createDate_gte" readonly="true" maxlength="20" class="form-control laydate width-date"
						dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="createDate_lte.click()"/>
						&nbsp;-&nbsp;
						<#form:input path="createDate_lte" readonly="true" maxlength="20" class="form-control laydate width-date"
						dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("编号")}', name:'paymentOrderCode', index:'a.payment_order_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/financial/ttpaymentorder/ttPaymentOrder/detail?ttPaymentOrderId='+row.ttPaymentOrderId+'" class="btnList" data-title="${text("编辑TT付款单")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("操作")}', name:'actions', width:140, sortable:false, title:false, formatter: function(val, obj, row, act){
						var actions = [];
						<% if(hasPermi('financial:ttpaymentorder:ttPaymentOrder:view')){ %>
                actions.push('<a href="${ctx}/financial/ttpaymentorder/ttPaymentOrder/detail?ttPaymentOrderId='+row.ttPaymentOrderId+'" class="btnList" title="${text("查看TT付款单")}"><i class="fa fa-file-text-o"></i></a>&nbsp;');
						<% } %>
					<% if(hasPermi('financial:ttpaymentorder:ttPaymentOrder:edit')){ %>
			actions.push('<a href="${ctx}/financial/ttpaymentorder/ttPaymentOrder/form?ttPaymentOrderId='+row.ttPaymentOrderId+'" class="btnList" title="${text("编辑TT付款单")}"><i class="fa fa-pencil"></i></a>&nbsp;');
	<% } %>
<% if(hasPermi('financial:ttpaymentorder:ttPaymentOrder:delete')){ %>
			actions.push('<a href="${ctx}/financial/ttpaymentorder/ttPaymentOrder/delete?ttPaymentOrderId='+row.ttPaymentOrderId+'" class="btnList" title="${text("删除TT付款单")}" data-confirm="${text("确认要删除该TT付款单吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
		return actions.join('');
		}},
		{header:'${text("服务订单")}', name:'serviceOrder.serviceOrderCode', index:'a.service_order_id', width:150, align:"center"},
		{header:'${text("客户")}', name:'customer.customerName', index:'a.customer_id', width:150, align:"center"},
		{header:'${text("资方")}', name:'investor.supplierName', index:'a.investor_id', width:150, align:"center"},
		{header:'${text("外商")}', name:'foreignBusinessmen.supplierName', index:'a.foreign_businessmen_id', width:150, align:"center"},
		{header:'${text("外商银行账号")}', name:'foreignBusinessmenBank', index:'a.foreign_businessmen_bank', width:150, align:"left"},
		{header:'${text("海外仓单据号")}', name:'overseasWarehouse.overseasWarehouseCode', index:'a.overseas_warehouse_code', width:150, align:"left"},
		{header:'${text("外商地址")}', name:'foreignBusinessmenAddress', index:'a.foreign_businessmen_address', width:150, align:"left"},
		{header:'${text("银行名称")}', name:'bank', index:'a.bank', width:150, align:"left"},
		{header:'${text("银行地址")}', name:'bankAddress', index:'a.bank_address', width:150, align:"left"},
		{header:'${text("swift码")}', name:'swiftCode', index:'a.swift_code', width:150, align:"left"},
		{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text("保证金比例")}', name:'marginRatio', index:'a.margin_ratio', width:150, align:"left"},
		{header:'${text("已收保证金")}', name:'marginReceived', index:'a.margin_received', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("币种")}', name:'currency', index:'a.currency', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_bizhong')}, val, '${text("未知")}', true);
		}},
		{header:'${text("购汇金额")}', name:'purchaseAmount', index:'a.purchase_amount', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("购汇汇率")}', name:'purchaseExchangeRate', index:'a.purchase_exchange_rate', width:150, align:"left"},
		{header:'${text("等值人民币价额")}', name:'rmbEquivalent', index:'a.rmb_equivalent', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("电报费")}', name:'telegramFee', index:'a.telegram_fee', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("手续费")}', name:'handlingFee', index:'a.handling_fee', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("合计")}', name:'total', index:'a.total', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("付汇日期")}', name:'paymentDate', index:'a.payment_date', width:150, align:"center"},
		{header:'${text("交易附言")}', name:'transactionMemo', index:'a.transaction_memo', width:150, align:"left"},
		{header:'${text("创建者")}', name:'createBy', index:'a.create_by', width:150, align:"left"},
		{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
	],
	frozenCols: true,
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>